package com.kyub.spring.gears.model;

import com.kyub.spring.gears.services.DaoService;

import java.util.Map;

/**

 */
public class PojoRegistry {

    private Map<String, PojoRegistryEntry> registry;
	private DaoService defaultDao;
	
	

    public DaoService getDefaultDao() {
		return defaultDao;
	}

	public void setDefaultDao(DaoService defaultDao) {
		this.defaultDao = defaultDao;
	}

	public Map getRegistry() {
        return registry;
    }

    public void setRegistry(Map<String, PojoRegistryEntry> registry) {
        this.registry = registry;
    }

    public DaoService getManager(String pojo) {

        final DaoService dao = registry.get(pojo).getDao();
        if(dao != null){
        	return dao;
        }else{
        	return defaultDao;
        }

    }

    public PojoRegistryEntry getPojoConf(Object key) {
        return registry.get(key);
    }
}
